package com.demo.controller;

import com.demo.common.base.ResultModel;
import com.demo.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: LoginController
 * @Author: ChenXueLi
 * @Date: 2018-10-02 15:05
 */
@Api(value = "LoginController", description = "用户接口")
@Controller
@CrossOrigin
//@RequestMapping("/")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @ApiOperation(value = "用户登录", notes = "用户登录接口", httpMethod = "POST")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    @ResponseBody
    public ResultModel login(String account, String password, ResultModel resultModel, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return loginService.login(account, password, resultModel, request, response);
    }

}
